package com.imooc.controller;

import com.imooc.pojo.MyConfig;
import com.imooc.pojo.Stu;
import com.imooc.pojo.Student;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Map;


//@Controller
@RestController
@RequestMapping("Stu")
@Slf4j
public class StuController {

    @GetMapping("{stdId}/get")
    public String get(@PathVariable("stdId") String stdId,
                      @RequestParam Integer id,
                      @RequestParam String name) {

        log.info("stdId=" + stdId + ", id=" + id + ", name=" + name);
        return "查询Stu";
    }

    @PostMapping("create")
    public String create(@RequestBody Map<String, Object> map,
                         @RequestHeader("token") String token,
                         @CookieValue("clientId") String clientId,
                         HttpServletRequest request) {

        log.info("token=" + token);
        log.info("clientId=" + clientId);
        log.info("map=" + map);
        String headerToken = request.getHeader("token");
        log.info("headerToken=" + headerToken);

        return "新增Stu";
    }

    @PutMapping("update")
    public String update() {
        return "修改Stu";
    }

    @DeleteMapping("delete")
    public String delete() {
        return "删除Stu";
    }


}
